﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;

namespace UpdaterForm.Converters
{
    [ValueConversion(typeof(string), typeof(bool))]
    public class IsUpdateFailed : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var log = (UpdateLog)value;
            if (log == null)
                return Visibility.Collapsed;
            return String.IsNullOrEmpty(log.FailReason) ? Visibility.Collapsed : Visibility.Visible;
            
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

    }
}
